//------------------模锟斤拷说锟斤拷---------------
//锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟狡讹拷锟斤拷
//-----------------------------------------
module out_ctrl_lamp(
		input	wire		resetb,
		input	wire		sclk,
		input   wire            oclk,
		
		input	wire		set_d_ok,
		input	wire	[15:0]	set_addr,
		input	wire	[7:0]	set_data,
		
		input	wire		init_correct_d_ok,
		input	wire	[18:0]	init_correct_addr,
		input	wire	[7:0]	init_correct_data,

		input   wire            t_us,
		input	wire		t_ms,
		input   wire            t_s,
		
		input   wire            out_en,
		input   wire            v_start,
		input   wire            black,
		input	wire	[7:0]	state,
		input	wire	[7:0]	state_2,
		input	wire	[8:0]	cascade_light,
		input	wire	[5:0]	device_port,

		input   wire    [63:0]  unit_color_adj,

		//显示数据缓冲接口
		output	wire		vs_out,
		output	wire		mem_read_req,
		output	wire		mem_read_last,
		output	wire	[11:0]	mem_h_addr,
		output	wire	[11:0]	mem_l_addr,
		input	wire		mem_read_ack,
		input	wire		mem_data_sync,
		input	wire	[31:0]	mem_read_data,
		
		output  wire		out_sync,
		output 	wire 	[15:0]	out_data,
		output 	wire 	[15:0]	out_data_n,
		output  wire            clk_out,
		output  wire            clk_out_n,
		
 		//DMX输出信号
		output	wire	[1:0]	dmx_mode,
		output  wire		dmx_send_flag,
		output	wire	[15:0]	out_data_dmx,
		
		//给反馈处理模块
		output  wire		mem_err_sel,	//0:mem处理流程。1:err处理流程。
		output	wire	[2:0]	err_port_num,
		output	wire		err_read_start,
		output	wire	[9:0]	div_count_max,	//125M分频时钟
		output 	wire	[3:0]	mem_active_port,//0：所有端口都选通，1~8，实际对应的1~8端口
		output 	wire		mem_read_start,

		output	wire	[31:0]	tout                        
                );

//****************************************************************
//			锟节诧拷锟脚猴拷
//****************************************************************
wire		out_clk, new_out_en, new_vsin;
wire    [7:0]	chip_type;
wire    [9:0]	clock_low_time, div_cnt;
wire    [9:0]	port_l_unit;
wire    [7:0]	shift_length_per_unit;
wire    [15:0]	MY9221_config, TI5970_config, MBI6024_config, ZQ1111_config;
wire    [15:0]	config_4, config_6, config_7,config_9;
wire	[15:0]	dmx_ack_config;
wire	[15:0]	current_adj1,current_adj2,current_adj3;
wire	[7:0]	config_8;
wire		w_addr_req,w_addr_req_end;
//选通锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟脚猴拷
wire		out_read_pixel_first, out_read_pixel_req;
wire	[7:0]	out_read_pixel_addr;
wire	[9:0]	out_read_unit_addr;
wire	[255:0]	out_read_data;
//锟斤拷模锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟脚猴拷
wire		a_p_first[17:0];
wire		a_p_req[17:0];
wire	[7:0]	a_p_addr[17:0];
wire	[9:0]	a_u_addr[17:0];

//选通锟斤拷锟侥斤拷织锟斤拷锟斤拷锟脚猴拷
wire            data_load_req;
wire            data_shift_req;
wire            r_shift_req;
wire	[3:0]	data_bit_sel;
//锟斤拷模锟斤拷锟斤拷锟斤拷锟侥斤拷织锟斤拷锟斤拷锟脚猴拷
wire            a_load[17:0];
wire            a_l_shift[17:0];
wire            a_r_shift[17:0];
wire	[3:0]	a_bit_sel[17:0];

//锟斤拷模锟斤拷锟斤拷锟斤拷锟狡具匡拷锟斤拷锟脚猴拷
wire 	[15:0]	a_o_data[17:0];
wire 	[15:0]	a_o_data_n[17:0];
wire            a_o_clk[17:0];
wire            a_o_clk_n[17:0];
wire            a_o_shift_req[1:0];
wire		a_o_sync[17:0];

wire            a_o_vsout[17:0];
wire		d_reverse;
wire	[15:0]	data_bit_gen, data_bit;

wire	[31:0]	tout_620x;
wire	[7:0]	ll_tout;
//****************************************************************
//			锟斤拷锟斤拷锟竭硷拷
//****************************************************************
//锟斤拷锟斤拷模锟斤拷锟斤拷锟斤拷
out_comon comon(
        .resetb			(resetb),
        .sclk			(sclk),
        .oclk			(oclk),
        
        .set_d_ok		(set_d_ok),    
        .set_addr		(set_addr),    
        .set_data		(set_data),
        
        .out_en			(out_en),    
        .vsin			(v_start),    
        
        .out_clk		(out_clk),
        .new_out_en		(new_out_en),
        .new_vsin		(new_vsin),
        
        .chip_type		(chip_type), 
        .div_count_max		(div_count_max), 
        .clock_low_time		(clock_low_time), 
        .div_cnt		(div_cnt),  
        .port_l_unit		(port_l_unit), 
        .shift_length_per_unit	(shift_length_per_unit), 
        .config_0		(MY9221_config),
        .config_1		(TI5970_config),
        .config_2		(MBI6024_config),
        .config_3		(ZQ1111_config),
        .config_4		(dmx_ack_config),
        .config_5		(current_adj1),
        .config_6		(current_adj2),
        .config_7		(current_adj3),
        .config_8		(config_8),
        .d_reverse		(d_reverse),

	.tout			()
	);                                 

//锟斤拷锟斤拷锟斤拷锟轿达拷锟斤拷
out_LL_data_ctrl display_data_ctrl(
        .resetb			(resetb),
        .sclk			(sclk),
        
        .set_d_ok		(set_d_ok),
        .set_addr		(set_addr),
        .set_data		(set_data),
        
        .vsin			(v_start),
        .black			(black),
	.cascade_light		(cascade_light),
	.device_port		(device_port),
	
	//输出读模块接口
        .out_read_pixel_req	(out_read_pixel_req),
        .out_read_pixel_addr	(out_read_pixel_addr),
        .out_read_unit_addr	(out_read_unit_addr),
        .out_read_data		(out_read_data),
        
	//显示数据读接口
        .mem_read_req		(mem_read_req),
        .mem_read_last		(mem_read_last),
        .mem_h_addr		(mem_h_addr), 
        .mem_l_addr		(mem_l_addr), 
        .mem_read_ack		(mem_read_ack), 
	.mem_data_sync		(mem_data_sync),
        .mem_read_data		(mem_read_data), 
	
        .tout			(ll_tout)
	);

//锟斤拷示锟斤拷锟捷斤拷织
out_data_shift data_shift(
	.resetb			(resetb),
	.out_clk		(out_clk),
	
	.read_data		(out_read_data),
	
	.r_shift_req		(r_shift_req),
	.data_bit_sel		(data_bit_sel),
	.data_load_req		(data_load_req),
	.data_shift_req		(data_shift_req),
	
	.data_bit		(data_bit_gen)
	);                

assign	data_bit = (d_reverse==1)? ~data_bit_gen:data_bit_gen;    
//assign	data_bit = ~data_bit_gen;
//选通锟斤拷模锟斤拷锟侥灯具匡拷锟斤拷锟脚猴拷
assign	out_read_pixel_first	= a_p_first[00] | a_p_first[01] | a_p_first[02] | a_p_first[03] | a_p_first[04] | a_p_first[05] | a_p_first[06] | a_p_first[07] | a_p_first[08] |
					a_p_first[09] | a_p_first[10] | a_p_first[11] | a_p_first[12] | a_p_first[13] | a_p_first[14] | a_p_first[15] | a_p_first[16] | a_p_first[17];
					
assign  out_read_pixel_req	= a_p_req[00] | a_p_req[01] | a_p_req[02] | a_p_req[03] | a_p_req[04] | a_p_req[05] | a_p_req[06] | a_p_req[07] | a_p_req[08] |
					a_p_req[09] | a_p_req[10] | a_p_req[11] | a_p_req[12] | a_p_req[13] | a_p_req[14] | a_p_req[15] | a_p_req[16] | a_p_req[17]; 
					
assign  out_read_pixel_addr	= a_p_addr[00] | a_p_addr[01] | a_p_addr[02] | a_p_addr[03] | a_p_addr[04] | a_p_addr[05] | a_p_addr[06] | a_p_addr[07] | a_p_addr[08] | 
					a_p_addr[09] | a_p_addr[10] | a_p_addr[11] | a_p_addr[12] | a_p_addr[13] | a_p_addr[14] | a_p_addr[15] | a_p_addr[16] | a_p_addr[17]; 
					
assign  out_read_unit_addr	= a_u_addr[00] | a_u_addr[01] | a_u_addr[02] | a_u_addr[03] | a_u_addr[04] | a_u_addr[05] | a_u_addr[06] | a_u_addr[07] | a_u_addr[08] | 
					a_u_addr[09] | a_u_addr[10] | a_u_addr[11] | a_u_addr[12] | a_u_addr[13] | a_u_addr[14] | a_u_addr[15] | a_u_addr[16] | a_u_addr[17]; 

assign  data_bit_sel	= a_bit_sel[00] | a_bit_sel[01] | a_bit_sel[02] | a_bit_sel[03] | a_bit_sel[04] | a_bit_sel[05] | a_bit_sel[06] | a_bit_sel[07] | a_bit_sel[08] | 
				a_bit_sel[09] | a_bit_sel[10] | a_bit_sel[11] | a_bit_sel[12] | a_bit_sel[13] | a_bit_sel[14] | a_bit_sel[15] | a_bit_sel[16] | a_bit_sel[17];                                                                       

assign  data_load_req   = a_load[00] | a_load[01] | a_load[02] | a_load[03] | a_load[04] | a_load[05] | a_load[06] | a_load[07] | a_load[08] | 
				a_load[09] | a_load[10] | a_load[11] | a_load[12] | a_load[13] | a_load[14] | a_load[15] | a_load[16] | a_load[17]; 

assign  data_shift_req	= a_l_shift[00] | a_l_shift[01] | a_l_shift[02] | a_l_shift[03] | a_l_shift[04] | a_l_shift[05] | a_l_shift[06] | a_l_shift[07] |a_l_shift[08] | 
				a_l_shift[09] | a_l_shift[10] | a_l_shift[11] | a_l_shift[12] | a_l_shift[13] | a_l_shift[14] | a_l_shift[15] | a_l_shift[16] | a_l_shift[17]; 

//assign	r_shift_req	= 0;

//assign  out_data	= a_o_data[00] | a_o_data[01] | a_o_data[02] | a_o_data[03] | a_o_data[04] | a_o_data[05] | a_o_data[06] | a_o_data[07] | a_o_data[08] | 
//				a_o_data[09] | a_o_data[10] | a_o_data[11] | a_o_data[12] | a_o_data[13] | a_o_data[14] | a_o_data[15] | a_o_data[16] | a_o_data[17]; 
				
assign  clk_out		= a_o_clk[00] | a_o_clk[01] | a_o_clk[02] | a_o_clk[03] | a_o_clk[04] | a_o_clk[05] | a_o_clk[06] | a_o_clk[07] | a_o_clk[08] | 
				a_o_clk[09] | a_o_clk[10] | a_o_clk[11] | a_o_clk[12] | a_o_clk[13] | a_o_clk[14] | a_o_clk[15] | a_o_clk[16] | a_o_clk[17];                                   

assign  out_data_n	= a_o_data_n[00] | a_o_data_n[01] | a_o_data_n[02] | a_o_data_n[03] |  a_o_data_n[04] | a_o_data_n[05] | a_o_data_n[06] | a_o_data_n[07] | a_o_data_n[08] | 
				a_o_data_n[09] | a_o_data_n[10] | a_o_data_n[11] | a_o_data_n[12] | a_o_data_n[13] | a_o_data_n[14] | a_o_data_n[15] | a_o_data_n[16] | a_o_data_n[17]; 

assign  clk_out_n	= a_o_clk_n[00] | a_o_clk_n[01] | a_o_clk_n[02] | a_o_clk_n[03] | a_o_clk_n[04] | a_o_clk_n[05] | a_o_clk_n[06] | a_o_clk_n[07] | a_o_clk_n[08] | 
				a_o_clk_n[09] | a_o_clk_n[10] | a_o_clk_n[11] | a_o_clk_n[12] | a_o_clk_n[13] | a_o_clk_n[14] | a_o_clk_n[15] | a_o_clk_n[16] | a_o_clk_n[17]; 

assign  vs_out		= a_o_vsout[00] | a_o_vsout[01] | a_o_vsout[02] | a_o_vsout[03] | a_o_vsout[04] | a_o_vsout[05] | a_o_vsout[06] | a_o_vsout[07] | a_o_vsout[08] | 
				a_o_vsout[09] | a_o_vsout[10] | a_o_vsout[11] | a_o_vsout[12] | a_o_vsout[13] | a_o_vsout[14] | a_o_vsout[15] | a_o_vsout[16] | a_o_vsout[17];                                   

assign	out_sync	= a_o_sync[0] | a_o_sync[1] | a_o_sync[12];

assign	r_shift_req	=a_o_shift_req[0] | a_o_shift_req[1];
//assign  load_out_all           =  load_out[00];   //3001锟斤拷锟斤拷锟斤拷锟斤拷

out_ctrl_TLS3001 out_ctrl_0(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
	.t_us                   (t_us),
	.t_ms                   (t_ms),
	.t_s                    (t_s),
	
        .out_clk                (out_clk),          
        .out_en                 (new_out_en),
        .vsin                   (new_vsin),
        .vsout                  (a_o_vsout[0]),
        
      
        .chip_type              (chip_type),
	.div_count_max		(div_count_max),
        .clock_low_time         (clock_low_time),
        .div_cnt                (div_cnt),
        .port_l_unit            (port_l_unit),
        .shift_length_per_unit  (shift_length_per_unit),
        .config_d               (),
        
        .read_pixel_req         (a_p_req[0]),  
        .read_pixel_first       (a_p_first[0]),
        .read_pixel_addr        (a_p_addr[0]),
        .read_unit_addr         (a_u_addr[0]),
        .data_bit               (data_bit),
        
        .data_load_req          (a_load[0]),
        .data_shift_req         (a_l_shift[0]),
        .data_bit_sel           (a_bit_sel[0]),

        .out_data               (a_o_data[0]),
        .clk_out                (a_o_clk[0]),
        .out_data_n             (a_o_data_n[0]),
        .clk_out_n              (a_o_clk_n[0]),
        .out_sync		(a_o_sync[0])
        );

out_ctrl_GW620x out_ctrl_1(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
        
	.t_us                   (t_us),
	.t_ms                   (t_ms),
	.t_s                    (t_s),
	
        .out_clk                (out_clk),          
        .out_en                 (new_out_en),
        .vsin                   (new_vsin),
        .vsout                  (a_o_vsout[01]),
                
        .chip_type              (chip_type),
	.div_count_max		(div_count_max),
        .clock_low_time         (clock_low_time),
        .div_cnt                (div_cnt),
        .port_l_unit            (port_l_unit),
        .shift_length_per_unit  (shift_length_per_unit),
        .current_adj1           (current_adj1),
        .current_adj2           (current_adj2),
        .current_adj3           (current_adj3),
        
        .out_data               (out_data),
        .clk_out                (a_o_clk[01]),
        .out_data_n             (a_o_data_n[01]),
        .clk_out_n              (a_o_clk_n[01]),
        .read_pixel_req         (a_p_req[01]),
        .read_pixel_first       (a_p_first[01]),
        .read_pixel_addr        (a_p_addr[01]),
        .read_unit_addr         (a_u_addr[01]),
        .data_load_req          (a_load[01]),
        .data_shift_req         (a_l_shift[01]),
        .data_bit_sel           (a_bit_sel[01]),
        .data_bit               (data_bit),
	.out_sync		(a_o_sync[1]),
        .tout			(tout_620x)
        );
        
out_ctrl_MY9221 out_ctrl_2(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
	.t_us                   (t_us),
	.t_ms                   (t_ms),
	.t_s                    (t_s),
	
        .out_clk                (out_clk),          
        .out_en                 (new_out_en),
        .vsin                   (new_vsin),
        .vsout                  (a_o_vsout[02]),
                
        .chip_type              (chip_type),
	.div_count_max		(div_count_max),
        .clock_low_time         (clock_low_time),
        .div_cnt                (div_cnt),
        .port_l_unit            (port_l_unit),
        .shift_length_per_unit  (shift_length_per_unit),
        .config_d               (MY9221_config           ),
        
        .out_data               (a_o_data[02]),
        .clk_out                (a_o_clk[02]),
        .out_data_n             (a_o_data_n[02]),
        .clk_out_n              (a_o_clk_n[02]),
        .read_pixel_req         (a_p_req[02]),
        .read_pixel_first       (a_p_first[02]),
        .read_pixel_addr        (a_p_addr[02]),
        .read_unit_addr         (a_u_addr[02]),
        .data_load_req          (a_load[02]),
        .data_shift_req         (a_l_shift[02]),
        .data_bit_sel           (a_bit_sel[02]),
        .data_bit               (data_bit                )
        );        
        
out_ctrl_TI5970 out_ctrl_3(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
	.t_us                   (t_us),
	.t_ms                   (t_ms),
	.t_s                    (t_s),
	
        .out_clk                (out_clk),          
        .out_en                 (new_out_en),
        .vsin                   (new_vsin),
        .vsout                  (a_o_vsout[03]),
                
        .chip_type              (chip_type),
	.div_count_max		(div_count_max),
        .clock_low_time         (clock_low_time),
        .div_cnt                (div_cnt),
        .port_l_unit            (port_l_unit),
        .shift_length_per_unit  (shift_length_per_unit),
        .config_d               (TI5970_config           ),

        .out_data               (a_o_data[03]),
        .clk_out                (a_o_clk[03]),
        .out_data_n             (a_o_data_n[03]),
        .clk_out_n              (a_o_clk_n[03]),
        .read_pixel_req         (a_p_req[03]),
        .read_pixel_first       (a_p_first[03]),
        .read_pixel_addr        (a_p_addr[03]),
        .read_unit_addr         (a_u_addr[03]),
        .data_load_req          (a_load[03]),
        .data_shift_req         (a_l_shift[03]),
        .data_bit_sel           (a_bit_sel[03]),
        .data_bit               (data_bit                )
        );

//assign	err_port_num=0;
//assign	err_read_start=0;
//assign	chip_dmx_ack=0;

//out_ctrl_DMX512 out_ctrl_4(
//        .resetb                 (resetb),
//        .oclk                   (oclk),
//        
//	.t_us                   (t_us),
//	.t_ms                   (t_ms),
//	.t_s                    (t_s),
//	
//        .out_clk                (out_clk),          
//        .out_en                 (new_out_en),
//        .vsin                   (new_vsin),
//        
//        .chip_type              (chip_type),
//	.div_count_max		(div_count_max),
//        .clock_low_time         (clock_low_time),
//        .div_cnt                (div_cnt),
//        .port_l_unit            (port_l_unit),
//        .shift_length_per_unit  (shift_length_per_unit),
//        .config_d               (dmx_ack_config),
//                                            
//        .out_data               (a_o_data[04]),
//        .clk_out                (a_o_clk[04]),
//        .out_data_n             (a_o_data_n[04]),
//        .clk_out_n              (a_o_clk_n[04]),
//        .read_pixel_req         (a_p_req[04]),
//        .read_pixel_first       (a_p_first[04]),
//        .read_pixel_addr        (a_p_addr[04]),
//        .read_unit_addr         (a_u_addr[04]),
//        .data_load_req          (a_load[04]),
//        .data_shift_req         (a_l_shift[04]),
//        .r_shift_req		(a_o_shift_req[0]),
//        .data_bit_sel           (a_bit_sel[04]),
//        .data_bit               (data_bit                ),
//
////        .err_port_num		(err_port_num),
////        .err_read_start		(err_read_start),
////        .chip_dmx_ack		(chip_dmx_ack),
////        
//        .tout			(tout_dmx)
//        );

assign a_o_data[04]	=0;
assign a_o_clk[04]	=0;
assign a_o_data_n[4]	=0;
assign a_o_clk_n[04]	=0;
assign a_p_req[04]	=0;
assign a_p_first[04]	=0;
assign a_p_addr[04]	=0;
assign a_u_addr[04]	=0;
assign a_load[04]	=0;
assign a_l_shift[04]	=0;
assign a_bit_sel[04]	=0;
assign a_o_vsout[04]	=0;

//out_ctrl_MBI6120 out_ctrl_4(
//        .resetb                 (resetb),
//        .oclk                   (oclk),
//        
//        .out_clk                (out_clk                 ),          
//        .out_en                 (new_out_en              ),
//        .vsin                   (new_vsin                ),
//        .vsout                  (a_o_vsout[04]),
//        .t_ms                   (t_ms                    ),
//        .t_s                    (t_s                     ),
//        .t_us                   (t_us                    ),        
//        .div_count_max          (div_count_max           ),
//        .clock_low_time         (clock_low_time          ),
//        .div_cnt                (div_cnt                 ),
//        .port_l_unit            (port_l_unit             ),
//        .shift_length_per_unit  (shift_length_per_unit   ),
//        .chip_type              (chip_type               ),
//        .config_d               (MBI6024_config          ),
//        .out_data               (a_o_data[04]),
//        .clk_out                (a_o_clk[04]),
//        .out_data_n             (a_o_data_n[04]),
//        .clk_out_n              (a_o_clk_n[04]),
//        .read_pixel_req         (a_p_req[04]),
//        .read_pixel_first       (a_p_first[04]),
//        .read_pixel_addr        (a_p_addr[04]),
//        .read_unit_addr         (a_u_addr[04]),
//        .data_load_req          (a_load[04]),
//        .data_shift_req         (a_l_shift[04]),
//        .data_bit_sel           (a_bit_sel[04]),
//        .data_bit               (data_bit                )
//        );
                
        
        
        
out_ctrl_TLS3008 out_ctrl_5(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
        .out_clk                (out_clk                 ),
        .out_en                 (new_out_en              ),
        .vsin                   (new_vsin                ),
        .vsout                  (a_o_vsout[05]),
        .t_ms                   (t_ms                    ),
        .t_s                    (t_s                     ),
        .t_us                   (t_us                    ),
        .div_count_max          (div_count_max           ),
        .clock_low_time         (clock_low_time          ),
        .div_cnt                (div_cnt                 ),
        .port_l_unit            (port_l_unit             ),
        .shift_length_per_unit  (shift_length_per_unit   ),
        .chip_type              (chip_type               ),
        .config_d               (                        ),
        .out_data               (a_o_data[05]),
        .clk_out                (a_o_clk[05]),
        .out_data_n             (a_o_data_n[05]),
        .clk_out_n              (a_o_clk_n[05]),
        .read_pixel_req         (a_p_req[05]),
        .read_pixel_first       (a_p_first[05]),
        .read_pixel_addr        (a_p_addr[05]),
        .read_unit_addr         (a_u_addr[05]),
        .data_load_req          (a_load[05]),
        .data_shift_req         (a_l_shift[05]),
        .data_bit_sel           (a_bit_sel[05]),
        .data_bit               (data_bit                )
        );

out_ctrl_MY9231 out_ctrl_6(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
        .out_clk                (out_clk                 ),          
        .out_en                 (new_out_en              ),
        .vsin                   (new_vsin                ),
        .vsout                  (a_o_vsout[06]),
        
        .t_ms                   (t_ms                    ),
        .t_s                    (t_s                     ),
        .t_us                   (t_us                    ),       
        .div_count_max          (div_count_max           ),
        .clock_low_time         (clock_low_time          ),
        .div_cnt                (div_cnt                 ),
        .port_l_unit            (port_l_unit             ),
        .shift_length_per_unit  (shift_length_per_unit   ),
        .chip_type              (chip_type               ),
        .config_d               (                        ),
        .out_data               (a_o_data[06]),
        .clk_out                (a_o_clk[06]),
        .out_data_n             (a_o_data_n[06]),
        .clk_out_n              (a_o_clk_n[06]),
        .read_pixel_req         (a_p_req[06]),
        .read_pixel_first       (a_p_first[06]),
        .read_pixel_addr        (a_p_addr[06]),
        .read_unit_addr         (a_u_addr[06]),
        .data_load_req          (a_load[06]),
        .data_shift_req         (a_l_shift[06]),
        .data_bit_sel           (a_bit_sel[06]),
        .data_bit               (data_bit                )
        );

out_ctrl_LPD6803 out_ctrl_7(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
        .out_clk                (out_clk                 ),          
        .out_en                 (new_out_en              ),
        .vsin                   (new_vsin                ),
        .vsout                  (a_o_vsout[07]),
        .t_ms                   (t_ms                    ),
        .t_s                    (t_s                     ),
        .t_us                   (t_us                    ),        
        .div_count_max          (div_count_max           ),
        .clock_low_time         (clock_low_time          ),
        .div_cnt                (div_cnt                 ),
        .port_l_unit            (port_l_unit             ),
        .shift_length_per_unit  (shift_length_per_unit   ),
        .chip_type              (chip_type               ),
        .config_d               (ZQ1111_config           ),
        .out_data               (a_o_data[07]),
        .clk_out                (a_o_clk[07]),
        .out_data_n             (a_o_data_n[07]),
        .clk_out_n              (a_o_clk_n[07]),
        .read_pixel_req         (a_p_req[07]),
        .read_pixel_first       (a_p_first[07]),
        .read_pixel_addr        (a_p_addr[07]),
        .read_unit_addr         (a_u_addr[07]),
        .data_load_req          (a_load[07]),
        .data_shift_req         (a_l_shift[07]),
        .data_bit_sel           (a_bit_sel[07]),
        .data_bit               (data_bit                ) 
        );

out_ctrl_LPD8806 out_ctrl_8(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
        .out_clk                (out_clk                 ),         
        .out_en                 (new_out_en              ),
        .vsin                   (new_vsin                ),
        .vsout                  (a_o_vsout[08]),
        .t_ms                   (t_ms                    ),
        .t_s                    (t_s                     ),
        .t_us                   (t_us                    ),        
        .div_count_max          (div_count_max           ),
        .clock_low_time         (clock_low_time          ),
        .div_cnt                (div_cnt                 ),
        .port_l_unit            (port_l_unit             ),
        .shift_length_per_unit  (shift_length_per_unit   ),
        .chip_type              (chip_type               ),
        .config_d               (ZQ1111_config           ),
        .out_data               (a_o_data[08]),
        .clk_out                (a_o_clk[08]),
        .out_data_n             (a_o_data_n[08]),
        .clk_out_n              (a_o_clk_n[08]),
        .read_pixel_req         (a_p_req[08]),
        .read_pixel_first       (a_p_first[08]),
        .read_pixel_addr        (a_p_addr[08]),
        .read_unit_addr         (a_u_addr[08]),
        .data_load_req          (a_load[08]),
        .data_shift_req         (a_l_shift[08]),
        .data_bit_sel           (a_bit_sel[08]),
        .data_bit               (data_bit                )
        );


out_ctrl_MBI6023 out_ctrl_9(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
        .out_clk                (out_clk                 ),          
        .out_en                 (new_out_en              ),
        .vsin                   (new_vsin                ),
        .vsout                  (a_o_vsout[09]),
        .t_ms                   (t_ms                    ),
        .t_s                    (t_s                     ),
        .t_us                   (t_us                    ),        
        .div_count_max          (div_count_max           ),
        .clock_low_time         (clock_low_time          ),
        .div_cnt                (div_cnt                 ),
        .port_l_unit            (port_l_unit             ),
        .shift_length_per_unit  (shift_length_per_unit   ),
        .chip_type              (chip_type               ),
        .config_d               (MBI6024_config          ),
        .out_data               (a_o_data[09]),
        .clk_out                (a_o_clk[09]),
        .out_data_n             (a_o_data_n[09]),
        .clk_out_n              (a_o_clk_n[09]),
        .read_pixel_req         (a_p_req[09]),
        .read_pixel_first       (a_p_first[09]),
        .read_pixel_addr        (a_p_addr[09]),
        .read_unit_addr         (a_u_addr[09]),
        .data_load_req          (a_load[09]),
        .data_shift_req         (a_l_shift[09]),
        .data_bit_sel           (a_bit_sel[09]),
        .data_bit               (data_bit                )
        );
        
//out_ctrl_MBI6024 out_ctrl_9(
//        .resetb                 (resetb),
//        .oclk                   (oclk),
//        
//        .out_clk                (out_clk                 ),          
//        .out_en                 (new_out_en              ),
//        .vsin                   (new_vsin                ),
//        .t_ms                   (t_ms                    ),
//        .t_s                    (t_s                     ),
//        .t_us                   (t_us                    ),        
//        .div_count_max          (div_count_max           ),
//        .clock_low_time         (clock_low_time          ),
//        .div_cnt                (div_cnt                 ),
//        .port_l_unit            (port_l_unit             ),
//        .shift_length_per_unit  (shift_length_per_unit   ),
//        .chip_type              (chip_type               ),
//        .config_d               (MBI6024_config          ),
//        .out_data               (a_o_data[09]),
//        .clk_out                (a_o_clk[09]),
//        .out_data_n             (a_o_data_n[09]),
//        .clk_out_n              (a_o_clk_n[09]),
//        .read_pixel_req         (a_p_req[09]),
//        .read_pixel_first       (a_p_first[09]),
//        .read_pixel_addr        (a_p_addr[09]),
//        .read_unit_addr         (a_u_addr[09]),
//        .data_load_req          (a_load[09]),
//        .data_shift_req         (a_l_shift[09]),
//        .data_bit_sel           (a_bit_sel[09]),
//        .data_bit               (data_bit                )
//        );
        
out_ctrl_ZQ1111 out_ctrl_10(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
        .out_clk                (out_clk                 ),
        .out_en                 (new_out_en              ),
        .vsin                   (new_vsin                ),
//        .vsout                  (a_o_vsout[10]),
        .t_ms                   (t_ms                    ),
        .t_s                    (t_s                     ),
        .t_us                   (t_us                    ),
        .div_count_max          (div_count_max           ),
        .clock_low_time         (clock_low_time          ),
        .div_cnt                (div_cnt                 ),
        .port_l_unit            (port_l_unit             ),
        .shift_length_per_unit  (shift_length_per_unit   ),
        .chip_type              (chip_type               ),
        .config_d               (ZQ1111_config           ),
//        .out_data               (a_o_data[10]),
//        .clk_out                (a_o_clk[10]),
//        .out_data_n             (a_o_data_n[10]),
//        .clk_out_n              (a_o_clk_n[10]),
//        .read_pixel_req         (a_p_req[10]),
//        .read_pixel_first       (a_p_first[10]),
//        .read_pixel_addr        (a_p_addr[10]),
//        .read_unit_addr         (a_u_addr[10]),
//        .data_load_req          (a_load[10]),
//        .data_shift_req         (a_l_shift[10]),
//        .data_bit_sel           (a_bit_sel[10]),
        .data_bit               (data_bit                ),        
        .read_data              (out_read_data           ) 
        );

assign a_o_vsout[10]	=0;
assign a_o_data[10]	=0;
assign a_o_clk[10]	=0;
assign a_o_data_n[10]	=0;
assign a_o_clk_n[10]	=0;
assign a_p_req[10]	=0;
assign a_p_first[10]	=0;
assign a_p_addr[10]	=0;
assign a_u_addr[10]	=0;
assign a_load[10]	=0;
assign a_l_shift[10]	=0;
assign a_bit_sel[10]	=0;

out_ctrl_MBI6020 out_ctrl_11(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
        .out_clk                (out_clk                 ),          
        .out_en                 (new_out_en              ),
        .vsin                   (new_vsin                ),
        .vsout                  (a_o_vsout[11]),
        .t_ms                   (t_ms                    ),
        .t_s                    (t_s                     ),
        .t_us                   (t_us                    ),        
        .div_count_max          (div_count_max           ),
        .clock_low_time         (clock_low_time          ),
        .div_cnt                (div_cnt                 ),
        .port_l_unit            (port_l_unit             ),
        .shift_length_per_unit  (shift_length_per_unit   ),
        .chip_type              (chip_type               ),
        .config_d               (MBI6024_config          ),                                             
        .out_data               (a_o_data[11]),
        .clk_out                (a_o_clk[11]),
        .out_data_n             (a_o_data_n[11]),
        .clk_out_n              (a_o_clk_n[11]),
        .read_pixel_req         (a_p_req[11]),
        .read_pixel_first       (a_p_first[11]),
        .read_pixel_addr        (a_p_addr[11]),
        .read_unit_addr         (a_u_addr[11]),
        .data_load_req          (a_load[11]),
        .data_shift_req         (a_l_shift[11]),
        .data_bit_sel           (a_bit_sel[11]),
        .data_bit               (data_bit                )
        );

//5971锟斤拷锟斤拷锟斤拷锟斤拷
out_ctrl_TI5971 out_ctrl_12(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
	.t_us                   (t_us),
	.t_ms                   (t_ms),
	.t_s                    (t_s),
	
        .out_clk                (out_clk),          
        .out_en                 (new_out_en),
        .vsin                   (new_vsin),
//      .vsout                  (a_o_vsout[12]),
                
        .chip_type              (chip_type),
	.div_count_max		(div_count_max),
        .clock_low_time         (clock_low_time),
        .div_cnt                (div_cnt),
        .port_l_unit            (port_l_unit),
        .shift_length_per_unit  (shift_length_per_unit),
        .config_d               ()//,
        
//        .read_pixel_req         (a_p_req[12]),
//        .read_pixel_first       (a_p_first[12]),
//        .read_pixel_addr        (a_p_addr[12]),
//        .read_unit_addr         (a_u_addr[12]),
//        .data_bit               (data_bit),
        
//        .data_load_req          (a_load[12]),
//        .data_shift_req         (a_l_shift[12]),
//        .data_bit_sel           (a_bit_sel[12]),
        
//	.out_data               (a_o_data[12]),
//        .clk_out                (a_o_clk[12]),
//        .out_data_n             (a_o_data_n[12]),
//        .clk_out_n              (a_o_clk_n[12]),
//        .out_sync		(a_o_sync[12])
       );

assign a_o_vsout[12]	=0;

assign a_p_req[12]	=0;
assign a_p_first[12]	=0;
assign a_p_addr[12]	=0;
assign a_u_addr[12]	=0;

assign a_load[12]	=0;
assign a_l_shift[12]	=0;
assign a_bit_sel[12]	=0;

assign a_o_data[12]	=0;
assign a_o_clk[12]	=0;
assign a_o_data_n[12]	=0;
assign a_o_clk_n[12]	=0;
assign a_o_sync[12]	=0;

out_ctrl_MBI6021 out_ctrl_13(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
        .out_clk                (out_clk                 ),          
        .out_en                 (new_out_en              ),
        .vsin                   (new_vsin                ),
        .vsout                  (a_o_vsout[13]),
        .t_ms                   (t_ms                    ),
        .t_s                    (t_s                     ),
        .t_us                   (t_us                    ),        
        .div_count_max          (div_count_max           ),
        .clock_low_time         (clock_low_time          ),
        .div_cnt                (div_cnt                 ),
        .port_l_unit            (port_l_unit             ),
        .shift_length_per_unit  (shift_length_per_unit   ),
        .chip_type              (chip_type               ),
        .config_d               (MBI6024_config          ),
        .out_data               (a_o_data[13]),
        .clk_out                (a_o_clk[13]),
        .out_data_n             (a_o_data_n[13]),
        .clk_out_n              (a_o_clk_n[13]),
        .read_pixel_req         (a_p_req[13]),
        .read_pixel_first       (a_p_first[13]),
        .read_pixel_addr        (a_p_addr[13]),
        .read_unit_addr         (a_u_addr[13]),
        .data_load_req          (a_load[13]),
        .data_shift_req         (a_l_shift[13]),
        .data_bit_sel           (a_bit_sel[13]),
        .data_bit               (data_bit                ) 
        );

out_ctrl_SM16716 out_ctrl_14(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
        .out_clk                (out_clk                 ),          
        .out_en                 (new_out_en              ),
        .vsin                   (new_vsin                ),
        .vsout                  (a_o_vsout[14]),
        .t_ms                   (t_ms                    ),
        .t_s                    (t_s                     ),
        .t_us                   (t_us                    ),        
        .div_count_max          (div_count_max           ),
        .clock_low_time         (clock_low_time          ),
        .div_cnt                (div_cnt                 ),
        .port_l_unit            (port_l_unit             ),
        .shift_length_per_unit  (shift_length_per_unit   ),
        .chip_type              (chip_type               ),
        .config_d               (MBI6024_config          ),
        .out_data               (a_o_data[14]),
        .clk_out                (a_o_clk[14]),
        .out_data_n             (a_o_data_n[14]),
        .clk_out_n              (a_o_clk_n[14]),
        .read_pixel_req         (a_p_req[14]),
        .read_pixel_first       (a_p_first[14]),
        .read_pixel_addr        (a_p_addr[14]),
        .read_unit_addr         (a_u_addr[14]),
        .data_load_req          (a_load[14]),
        .data_shift_req         (a_l_shift[14]),
        .data_bit_sel           (a_bit_sel[14]),
        .data_bit               (data_bit)
        );

wire	[31:0]	dmx_tout;

out_ctrl_DMX512 out_ctrl_15(
        .resetb                 (resetb),
        .sclk                   (sclk),
        .out_clk                (out_clk),          
        
	.t_us                   (t_us),
	.t_ms                   (t_ms),
	.t_s                    (t_s),
	
	.state_2		(state_2),
        .led_light		(led_light),
 	
        .chip_type              (chip_type),
	.div_count_max		(div_count_max),
        .clock_low_time         (clock_low_time),
        .div_cnt                (div_cnt),
        .port_l_unit            (port_l_unit),
        .shift_length_per_unit  (shift_length_per_unit),
        .config_d               (dmx_ack_config),
        .config_custom		(config_8),
                                            
        .out_en                 (new_out_en),
        .vsin                   (new_vsin),
        .vsout                  (a_o_vsout[15]),
        
        .read_pixel_req         (a_p_req[15]),
        .read_pixel_first       (a_p_first[15]),
        .read_pixel_addr        (a_p_addr[15]),
        .read_unit_addr         (a_u_addr[15]),
        .data_load_req          (a_load[15]),
        .data_shift_req         (a_l_shift[15]),
        .r_shift_req		(a_o_shift_req[1]),
        .data_bit_sel           (a_bit_sel[15]),
        .data_bit               (data_bit),

 	//DMX输出信号
	.dmx_mode		(dmx_mode),
        .dmx_send_flag		(dmx_send_flag),
        .out_data_dmx		(out_data_dmx),

 	//DMXACK5034模式标志
        .custom_map		(custom_map),
        
	//调试信号
        .tout			(dmx_tout)
        );
        
assign a_o_data[15]	=0;
assign a_o_clk[15]	=0;
assign a_o_data_n[15]	=0;
assign a_o_clk_n[15]	=0;
//assign a_p_req[15]	=0;
//assign a_p_first[15]	=0;
//assign a_p_addr[15]	=0;
//assign a_u_addr[15]	=0;
//assign a_load[15]	=0;
//assign a_l_shift[15]	=0;
//assign a_bit_sel[15]	=0;
        
out_ctrl_WS280x out_ctrl_16(
        .resetb                 (resetb),
        .oclk                   (oclk),
        
        .out_clk                (out_clk                 ),        
        .out_en                 (new_out_en              ),
        .vsin                   (new_vsin                ),
        .vsout                  (a_o_vsout[16]),
        
        .t_ms                   (t_ms                    ),
        .t_s                    (t_s                     ),
        .t_us                   (t_us                    ),        
        .div_count_max          (div_count_max           ),
        .clock_low_time         (clock_low_time          ),
        .div_cnt                (div_cnt                 ),
        .port_l_unit            (port_l_unit             ),
        .shift_length_per_unit  (shift_length_per_unit   ),
        .chip_type              (chip_type               ),
        .config_d               (                        ),
        .out_data               (a_o_data[16]),
        .clk_out                (a_o_clk[16]),
        .out_data_n             (a_o_data_n[16]),
        .clk_out_n              (a_o_clk_n[16]),
        .read_pixel_req         (a_p_req[16]),
        .read_pixel_first       (a_p_first[16]),
        .read_pixel_addr        (a_p_addr[16]),
        .read_unit_addr         (a_u_addr[16]),
        .data_load_req          (a_load[16]),
        .data_shift_req         (a_l_shift[16]),
        .data_bit_sel           (a_bit_sel[16]),
        .data_bit               (data_bit                ),
        .tout               	(tout_280x)
        );

out_ctrl_DM631 out_ctrl_17(                                    
        .resetb                 (resetb                  ),    
        .oclk                   (oclk                    ),    
        .out_clk                (out_clk                 ),    
        .out_en                 (new_out_en              ),    
        .vsin                   (new_vsin                ),    
        .vsout                  (a_o_vsout[17]),
        
        .t_ms                   (t_ms                    ),    
        .t_s                    (t_s                     ),    
        .t_us                   (t_us                    ),    
        .div_count_max          (div_count_max           ),    
        .clock_low_time         (clock_low_time          ),    
        .div_cnt                (div_cnt                 ),    
        .port_l_unit            (port_l_unit             ),    
        .shift_length_per_unit  (shift_length_per_unit   ),    
        .chip_type              (chip_type               ),    
        .config_d               (TI5970_config           ),    
        .out_data               (a_o_data[17]),    
        .clk_out                (a_o_clk[17]),    
        .out_data_n             (a_o_data_n[17]),    
        .clk_out_n              (a_o_clk_n[17]),    
        .read_pixel_req         (a_p_req[17]),    
        .read_pixel_first       (a_p_first[17]),    
        .read_pixel_addr        (a_p_addr[17]),    
        .read_unit_addr         (a_u_addr[17]),    
        .data_load_req          (a_load[17]),
        .data_shift_req         (a_l_shift[17]),
        .data_bit_sel           (a_bit_sel[17]),
        .data_bit               (data_bit                ),
        .load_out               ()//(load_out            [00])     
        );                                                    
        
//****************************************************************
//		锟斤拷锟斤拷锟脚猴拷
//****************************************************************
//	tout = {resetb,oclk,t_us,t_ms,t_s,out_clk,new_out_en,new_vsin,dmx_tout[1:0]};
assign	tout = {ll_tout, out_read_pixel_first};//dmx_tout;//tout_620x;

endmodule                